local skel = fk.CreateSkill {
  name = "rmt__zhuozheng",
}

Fk:loadTranslationTable{
  ["rmt__zhuozheng"] = "琢政",
  [":rmt__zhuozheng"] = "出牌阶段开始时，你可以将此武将牌上的一个技能或你拥有的一个隐匿技的时机修改为：体力值和手牌数均与你相等的角色"..
  "出牌阶段结束时。<br>（点击“琢政”标记可以查看修改过的技能）",

  ["#rmt__zhuozheng-choice"] = "琢政：你可以修改一个技能的时机为“与你体力值和手牌数均相等的角色出牌阶段结束时”",
  ["@[:]rmt__zhuozheng"] = "琢政",

  ["$rmt__zhuozheng1"] = "政宽则民慢、猛则民残，为政当琢以和。",
  ["$rmt__zhuozheng2"] = "布政优优、百禄是遒；柔远能迩，以定我王。",
}


skel:addEffect(fk.EventPhaseStart, {
  anim_type = "special",
  events = {fk.EventPhaseStart},
  can_trigger = function(self, event, target, player, data)
    if target == player and player:hasSkill(skel.name) and player.phase == Player.Play then
      local choices = {"Cancel"}
      for _, skill in ipairs({"rmt__fuzhi", "rmt__zhuozheng", "rmt__zuhe", "rmt__pozhi"}) do
        if player:hasSkill(skill, true) and not table.contains(player:getTableMark("@[:]rmt__zhuozheng"), skill) then
          table.insert(choices, skill)
        end
      end
      for _, skill in ipairs(player.player_skills) do
        if skill:hasTag(Skill.Hidden) and not table.contains(player:getTableMark("@[:]rmt__zhuozheng"), skill.name) then
          table.insertIfNeed(choices, skill.name)
        end
      end
      if #choices > 0 then
        event:setCostData(self, choices)
        return true
      end
    end
  end,
  on_cost = function(self, event, target, player, data)
    local choice = player.room:askToChoice(player, {
      choices = event:getCostData(self), skill_name = skel.name, prompt = "#rmt__zhuozheng-choice", detailed = true
    })
    if choice ~= "Cancel" then
      event:setCostData(self, choice)
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    player.room:addTableMark(player, "@[:]rmt__zhuozheng", event:getCostData(self))
  end,
})

---TODO: 
---方案1，直接执行onTrigger内容，跳过canTrigger检查，缺点：喜欢在canTrigger设置costData的技能将爆炸
---方案2：根据TriggerEvent类型，伪造TriggerData，安全性高，缺点：可能伪造失败，没法通过canTrigger检查

return skel
